package ink.xiaobaibai.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author xiaobaibai
 * @since 2021-06-05
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("coupon")
public class Coupon implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 优惠券id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 活动名称
     */
    @TableField("name")
    @Length(max = 25)
    @NotBlank
    private String name;

    /**
     * 折扣率(1%~100%)
     */
    @TableField("percentage")
    @Min(1)
    @Max(99)
    @NotNull
    private Integer percentage;

    /**
     * 生成数量
     */
    @TableField("all_count")
    @Min(value = 1)
    @NotNull
    private Integer allCount;

    /**
     * 剩余数量
     */
    @TableField("remaining_count")
    @Min(value = 1)
    @Null
    private Integer remainingCount;

    /**
     * 使用数量
     */
    @TableField("use_count")
    @Null
    private Integer useCount;

    /**
     * 领取后的有效天数
     */
    @TableField("useful_day")
    @Min(value = 1)
    @NotNull
    private Integer usefulDay;

    /**
     * 截止领取时间
     */
    @TableField("deadline")
    @Future
    @NotNull
    private Date deadline;

    /**
     * 是否停用
     */
    @TableField("stop_use")
    @Null
    private Boolean stopUse;

    /**
     * 是否需要授权手机号
     */
    @TableField("phone_flag")
    private Boolean phoneFlag;

    /**
     * 业务类型 0定点 1月费
     */
    @TableField("type")
    @NotNull
    @Min(0)
    @Max(1)
    private Integer type;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;


}
